package org.example;

public class Demo02 {
    int a;
    String str = "hello";
    public Demo02(){
        this(1);//this必须在第一行
    }
    public Demo02(int a){
        this.a = a;
        System.out.println("333");
    }
    public Demo02(int a,String str){
        this.a = a;
        this.str = str;
        System.out.println("444");
    }
    public void m1(){
        System.out.println("111");
        System.out.println(this.a);//调用属性
        this.m2();
    }
    public void m2(){
        System.out.println("222");
    }

    public static void main(String[] args) {
        new Demo02();//调用无参构造方法，创作对象
    }
}
